UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Et59NP4Pj5jKCyluDOIdl7femmFSzIY4uzR9+k+Mqdk='
WHERE
key_id = 'd435a53211bef8052aba504d3a531496307c596bb99136bf0d07cfab1d89019a'
AND (
token = 'Et59NP4Pj5jKCyluDOIdl7femmFSzIY4uzR9+k+Mqdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)