UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KEGAkcy4HrdUwO5Htp4Xy33/h0ZfSmAStevIR1Xot60=' 
WHERE 
  key_id = '17e8c337c1b865f347ecc13121b89d823ed07c4625f37dfc26a39f9e97e6eaf9' 
  AND (
    token = 'KEGAkcy4HrdUwO5Htp4Xy33/h0ZfSmAStevIR1Xot60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023