UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rHhfoEOnWBTYVDOnFAAsKLqBz82orJRpMjs7THf66+s=' 
WHERE 
  key_id = '8227db39d0c8ec300aaf2b0efcdbec83f3d5b31d4885c187e387d4b6d8bdd03d' 
  AND (
    token = 'rHhfoEOnWBTYVDOnFAAsKLqBz82orJRpMjs7THf66+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029