UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mi0I2Mrv6zO8w2flQHoIwqU+tQaFsJeYKF34US9P/VI='
WHERE
key_id = 'a898556ce9798e229b119399df0f2f43b9f01671a4350fa76bef2dca560e14dc'
AND (
token = 'Mi0I2Mrv6zO8w2flQHoIwqU+tQaFsJeYKF34US9P/VI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)