UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8pP8w5LBEGhPZvU6XBQM6Ut8doo9girOCMYzExg5yIc='
WHERE
key_id = '65eb344e7882ce03e88f0b641ff736bcde3215851a115e5cc748cb154a5fb30e'
AND (
token = '8pP8w5LBEGhPZvU6XBQM6Ut8doo9girOCMYzExg5yIc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)