UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XvlkiVP7y70zXn9EFXHEYGME9lG2QQBwl36YKplgVTc='
WHERE
key_id = 'c635911a2352ac41079f66fe5053333042af2f999b5b8e043c0f57a1a1b5f7aa'
AND (
token = 'XvlkiVP7y70zXn9EFXHEYGME9lG2QQBwl36YKplgVTc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)