UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XeQPF3Hgi2OT+DbeAaLa4C++/WuAXBCWmhkAPzWpBEk=' 
WHERE 
  key_id = 'c56786c6acf9bba8db56bf602e9dde912b300c6ad89fa176be19eb742c4a8615' 
  AND (
    token = 'XeQPF3Hgi2OT+DbeAaLa4C++/WuAXBCWmhkAPzWpBEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018