UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zxe6odWA0OdnnSWd+QAYGRozn+RM9N5zWGYxscgLZd8=' 
WHERE 
  key_id = '8fe41393b885d24db5f79ae942ba6b3e46752ae181b1a75b59df09503e5efacf' 
  AND (
    token = 'zxe6odWA0OdnnSWd+QAYGRozn+RM9N5zWGYxscgLZd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038