UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gbdGQeA22Lp/vI1+9xsUHrt4REec8s5ucPYtQfwvHmY='
WHERE
key_id = 'f59ea75ef362f7d1ee60875dcea7feee1b355199be7a0fa573958f78a4b7af5b'
AND (
token = 'gbdGQeA22Lp/vI1+9xsUHrt4REec8s5ucPYtQfwvHmY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)