UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RRP11FQQ1L0dhCyCT8r+9CZxenQ3wQcF5Z6DTNzvNBE=' 
WHERE 
  key_id = '667cc116a8d9d9d54b1a25448a1e30385c90171d742ce9ef28a6074de9c6d41b' 
  AND (
    token = 'RRP11FQQ1L0dhCyCT8r+9CZxenQ3wQcF5Z6DTNzvNBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022