UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4AGVanBXjGqoasoub17OQl8umGdnm9wUjyhDT9l5HR8=' 
WHERE 
  key_id = '350aec0fe614cc500f6fb6c1f979e18d26b70faba5de2f35e588de62133b790f' 
  AND (
    token = '4AGVanBXjGqoasoub17OQl8umGdnm9wUjyhDT9l5HR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029