UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z8eVFpVDf95vWyHDgqFCUM5DUPpYIyo7LruzDY0H2VM='
WHERE
key_id = '946466c8c1ef847d467f1871989c43cd24be1ffbfd923c1e38b1d992c8422c1c'
AND (
token = 'Z8eVFpVDf95vWyHDgqFCUM5DUPpYIyo7LruzDY0H2VM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)