UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FFLp86pdkBn/S4RPu2cSB9Mj5LOVuUa0L6nVIwJkLL4=' 
WHERE 
  key_id = '874972112d9218e9700ab12c044b049f6f3c8ea8d502bb9b1138e52fb6147a80' 
  AND (
    token = 'FFLp86pdkBn/S4RPu2cSB9Mj5LOVuUa0L6nVIwJkLL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052