UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j+8kcgaxgx+jc8YAuxRd1UsL6im01MjubBbG8vVUCCg=' 
WHERE 
  key_id = '6106d761f99e681f13cb88121f2fa23aee37af441465dc3d34b8acfc9f4f7522' 
  AND (
    token = 'j+8kcgaxgx+jc8YAuxRd1UsL6im01MjubBbG8vVUCCg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051