UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ynM9fWuDW0M3K6XhCkzcqaqoWwE/UjFzgMArPBOPZOo=' 
WHERE 
  key_id = 'f514463bae0399e80e235fa2f490f6c075b6cb1d2afcbfdcf8a1273130fb6a3d' 
  AND (
    token = 'ynM9fWuDW0M3K6XhCkzcqaqoWwE/UjFzgMArPBOPZOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040