UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H77oZu9NHkt8+eOhs7Zh68suYK65ukemAG8lnQTZsfY='
WHERE
key_id = '8b8d6a308a85409058aa1f6eb3efa90d30791c1b6d0f5cb4da5aac5a886db993'
AND (
token = 'H77oZu9NHkt8+eOhs7Zh68suYK65ukemAG8lnQTZsfY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)