UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'miy9U7rSk+ZDwXu+7I89P1Ip02K6PGm8J7GjfeFyfeA='
WHERE
key_id = '00172300f10075651e8ed4d1f30ea7c38c7978bdad11ad277bf43d4b26c39a5e'
AND (
token = 'miy9U7rSk+ZDwXu+7I89P1Ip02K6PGm8J7GjfeFyfeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)