UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ije6vckJluMAM+JrcYTZoObWL/8KdiYp0OiviOF9i/4=' 
WHERE 
  key_id = '1a4507ab122b0be9144334ba9f71e9a6cf779b18fa516a05936789b7aacc9389' 
  AND (
    token = 'Ije6vckJluMAM+JrcYTZoObWL/8KdiYp0OiviOF9i/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032