UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sv4EPiEKjc0eZ90nztpdrV80cuKQ1Xi3D5Y+RxNEctE=' 
WHERE 
  key_id = '239d00b1ad2f3f40fa168edd3ffa24ac28729ac686dfab03f6b26e40d90a7f92' 
  AND (
    token = 'Sv4EPiEKjc0eZ90nztpdrV80cuKQ1Xi3D5Y+RxNEctE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021