UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HAotcDO96tSiIedXma17+BJW5+XekVPCghnkeqStu/8='
WHERE
key_id = 'e59c462623400597267281b789aece69208b13b06abcf35f5ade77c9ac32a03a'
AND (
token = 'HAotcDO96tSiIedXma17+BJW5+XekVPCghnkeqStu/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)