UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CKR2I8ZQU3EbD+G2p1MBhJfhbP2RPlbU4FiLXckPXvU=' 
WHERE 
  key_id = 'f657853870c02bb0eaa7d2c7a4e9072e69947e1511ac6aea3a8123d9e7b6f730' 
  AND (
    token = 'CKR2I8ZQU3EbD+G2p1MBhJfhbP2RPlbU4FiLXckPXvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025