UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aAsP3OG2WshozeZIsc+rk65MZa3rzMPRrkjH0f/IyMU='
WHERE
key_id = '21d39435ba6a2691b3e1a829cf17b613131fffa51bd03a70d0fa04a1eaf9bf31'
AND (
token = 'aAsP3OG2WshozeZIsc+rk65MZa3rzMPRrkjH0f/IyMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)