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