UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8SJgBXV5aAvojcpfbWVpUXdRJrGyfz7azk0kXwfdbAU='
WHERE
key_id = '0aa044fca33bf9d81a5c794f41052295b0dbf93e482938161e7341f6ab32a36c'
AND (
token = '8SJgBXV5aAvojcpfbWVpUXdRJrGyfz7azk0kXwfdbAU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)