UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y/nS8/ez+z7005fygqEHeLQ1nbuP5QXMdMZ5zT2DR3s=' 
WHERE 
  key_id = '5c98d96768bedcfcec474739f1d0a102e6159a05c9bf5f337982198058e3276b' 
  AND (
    token = 'Y/nS8/ez+z7005fygqEHeLQ1nbuP5QXMdMZ5zT2DR3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027