UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gNQuR13vqiRL9vmzt/A38A+9sv84NEyFXLqqxD9vdjM=' 
WHERE 
  key_id = '904a6912f67df87a994795593c8f307bfbb368b58fddf320eefb1e5e220cf64c' 
  AND (
    token = 'gNQuR13vqiRL9vmzt/A38A+9sv84NEyFXLqqxD9vdjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026