UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l7LTxzPVt1CwwX/Cq91KZ8/xvntDsEj9JZWWprE4K0U='
WHERE
key_id = '22bbeb27c2521a385d7e2409c8a054c2b4f1395129008f37916db3f677443784'
AND (
token = 'l7LTxzPVt1CwwX/Cq91KZ8/xvntDsEj9JZWWprE4K0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)