UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CtAQKeCh6DZkOGjJwfpbx5WW502Cxs4a5PlV7q1bUbY=' 
WHERE 
  key_id = 'bc320ef124ffb8d0128e77b3b9d13fa10defb44b6d1ddce94b4821535709797c' 
  AND (
    token = 'CtAQKeCh6DZkOGjJwfpbx5WW502Cxs4a5PlV7q1bUbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048