UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TWF5OLYfAqjRaA8416ubYTzGQuWKLI1uSEa4qE7kKKA='
WHERE
key_id = '239202f13b30234f13eaab15198f0e4bd538d5cc131a6b423548040c665f2c02'
AND (
token = 'TWF5OLYfAqjRaA8416ubYTzGQuWKLI1uSEa4qE7kKKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)