UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AMpghG+j8DGMqM+QKS89cWBwyY2onUVeqBvsBEiBeBM='
WHERE
key_id = 'c49fce50e7bcd515fec7ebd916c98765aa6101e3744b1b51c49653f957fe0a0c'
AND (
token = 'AMpghG+j8DGMqM+QKS89cWBwyY2onUVeqBvsBEiBeBM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)