UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xeUiPSgRFYrmsie0iMo7CXGz2GvA1kdyCVZS7Ddnjbw=' 
WHERE 
  key_id = '616f2d2a6e4a6b07a0469813263993899781e6e51fa7888fccd717cc5dc0bd94' 
  AND (
    token = 'xeUiPSgRFYrmsie0iMo7CXGz2GvA1kdyCVZS7Ddnjbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036