UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tDbhbhS3A+m9X0i1MxLcDP7gh7dsT3D46wlvfFnprOQ=' 
WHERE 
  key_id = '3dfa409921b9b653aaeb6569c6ff810ad14e5f35441ad07d56fa33843336a830' 
  AND (
    token = 'tDbhbhS3A+m9X0i1MxLcDP7gh7dsT3D46wlvfFnprOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029