UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qZdzvlT0R8FtnNFudiH9PUDlbiHD6C5P6Xj6CCLRIcQ='
WHERE
key_id = '478264882170a2c2c1b9a48b3327068ae76308761c0b804f2ee78a44ea2cf579'
AND (
token = 'qZdzvlT0R8FtnNFudiH9PUDlbiHD6C5P6Xj6CCLRIcQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)