UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L0lj7GIfjvlzxuM8wBTegNz6lMC0sD/FXbM8Ks+dSQ0='
WHERE
key_id = 'a893402b3bd9fabcd04b5259538345a7507d762699fce161d407110be8faaa85'
AND (
token = 'L0lj7GIfjvlzxuM8wBTegNz6lMC0sD/FXbM8Ks+dSQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)