UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yTHA+jD21HUvmciUoIv6QsdfZ6ScfLhP4INauBhMZio='
WHERE
key_id = 'ce6bf25b71cc3d59977a9d620752543b568241ac9bb82fd43c371b4c55f94e7a'
AND (
token = 'yTHA+jD21HUvmciUoIv6QsdfZ6ScfLhP4INauBhMZio='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)