UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oJFGYCVGF47hU1FDCB+6+rwuV/X34Ln2MuYcm9gMK4c=' 
WHERE 
  key_id = '5402368b0ded5de3923469948cc09481cb3651cf8af42a8003e12e6f7f6404dc' 
  AND (
    token = 'oJFGYCVGF47hU1FDCB+6+rwuV/X34Ln2MuYcm9gMK4c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033