UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dCN+zPUuryx3E3aF1nFW+auYJ0bKz22ZGcd5tfVxGwU=' 
WHERE 
  key_id = 'd94645866f6c34db1a6aa0e556903b9d541b2baa9083f580b6f842d8aed51841' 
  AND (
    token = 'dCN+zPUuryx3E3aF1nFW+auYJ0bKz22ZGcd5tfVxGwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034