UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hnkjji6Q2DeP+JXmWxNFbJUQaGUM9+AR8SRKdp6Wm9w='
WHERE
key_id = '58cf7445efd1e6b49eb793905fc02f716c72c1c722801d0380b10f7e99467301'
AND (
token = 'Hnkjji6Q2DeP+JXmWxNFbJUQaGUM9+AR8SRKdp6Wm9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)