UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ynrdUCwzZDvlUerd+B0obLOTwVNS2/e9fGWyqSfhUZY=' 
WHERE 
  key_id = '9d37fd8a47c2fbf35b070a535b53786f0cae129c4c66119cf748251e5f1b1f6d' 
  AND (
    token = 'ynrdUCwzZDvlUerd+B0obLOTwVNS2/e9fGWyqSfhUZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032