UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '56+TVVJI/8yEJ8dZZfpX88An8X67tK3Btt20XXd6HAA=' 
WHERE 
  key_id = '18f677dde35bdb03aec89c4452c84cb2b3ab8fc58d67629d5b6180b23715713b' 
  AND (
    token = '56+TVVJI/8yEJ8dZZfpX88An8X67tK3Btt20XXd6HAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018