UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's9zQCl7GZ8htrX4y29Or913PO3kDYmoP4PyU5VkyxKk='
WHERE
key_id = 'f3acf9cd895406d0316845ed70a2895503b3427b5631a7a672dc417c13fa4701'
AND (
token = 's9zQCl7GZ8htrX4y29Or913PO3kDYmoP4PyU5VkyxKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)