UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0lOqitQSghMe5GcMM8cBQQBXkQAEPFMcKYERipkU3rA=' 
WHERE 
  key_id = '95a2c16b74607e7243268df723275f217f41ea36812556a77d973d0f3da53944' 
  AND (
    token = '0lOqitQSghMe5GcMM8cBQQBXkQAEPFMcKYERipkU3rA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022