UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DsgR7i138ZDmP9sc0u7BckEGv/uijLZt1eO+CMW9N0o='
WHERE
key_id = 'a58df193962f8c4a6efe69e6418e9edc3c9c0d98ffa27830365820c598420fb9'
AND (
token = 'DsgR7i138ZDmP9sc0u7BckEGv/uijLZt1eO+CMW9N0o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)