UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z3tjsVo/0nmvZvHhE852UUmyC5FxIOSSwe1y+zp3k5k=' 
WHERE 
  key_id = '26da279318537045e4728e3808357c3d9169d8e451411ce79d2ea06f62cd6188' 
  AND (
    token = 'z3tjsVo/0nmvZvHhE852UUmyC5FxIOSSwe1y+zp3k5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047