UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9LQpR62hPoYneeYXVSENGO+1XTOlYBJKO0urjrD+mMs=' 
WHERE 
  key_id = 'd2124e68f2e5c976d3d2fc2e9a49324d6d66e6030f1c5a999cedd05201a7d16a' 
  AND (
    token = '9LQpR62hPoYneeYXVSENGO+1XTOlYBJKO0urjrD+mMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040