UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rgNuSemTumjEMmspRv/mxFjKXFpwvRHAqyLPotS4Fgc='
WHERE
key_id = 'a993116c43bd4e18442fb6a3475f55de7e6ae954c50b546bd8ec02644f94df22'
AND (
token = 'rgNuSemTumjEMmspRv/mxFjKXFpwvRHAqyLPotS4Fgc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)