UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SH2LrhjyXTHro5qNqa+nGs9gMNOn29QX5k+3y/QJvrw=' 
WHERE 
  key_id = '254c85cc54d00b96c8630c8eeac2fe3875af07021fee1508b9a1f98447abf432' 
  AND (
    token = 'SH2LrhjyXTHro5qNqa+nGs9gMNOn29QX5k+3y/QJvrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027