UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g0s4EPU/0wiX+4uFgSTY9kEv7dQCmUDQXKq9K8/VVTo=' 
WHERE 
  key_id = '1680bdce675636e0736f7b8e70745bb604e98e09a66605f5164e08a883c511dd' 
  AND (
    token = 'g0s4EPU/0wiX+4uFgSTY9kEv7dQCmUDQXKq9K8/VVTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032