UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dIAEOX0xV2alm0ZG1FEUbEZCrb5coP0kU6eYkrxNxDw='
WHERE
key_id = 'bff6595757fab40dab1c7138a0dee950f18be0ec0a6b63455f9adb7103e981f0'
AND (
token = 'dIAEOX0xV2alm0ZG1FEUbEZCrb5coP0kU6eYkrxNxDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)