UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pj5BuiCGLBunETywCHHnyjLloSLmFZlaGf7U4t3fWhs=' 
WHERE 
  key_id = 'd3cd14910ac34c17e9d08519459f2df4cf2c7d6e68d1e45e02a5ca42e60340a8' 
  AND (
    token = 'Pj5BuiCGLBunETywCHHnyjLloSLmFZlaGf7U4t3fWhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033