UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nDetQg4jdGGtbVdJwom92CA3AOe0cTBFyMM229W/nkY='
WHERE
key_id = '8ae54b2a622db4f14daafdc175e6be2f17af5a3129dd0d352f5ccced814bd2bb'
AND (
token = 'nDetQg4jdGGtbVdJwom92CA3AOe0cTBFyMM229W/nkY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)