UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ie40adaInqpaIZckG3MtSa9UxFRo1rAZe/Wv6+r7+N8='
WHERE
key_id = '626a13cf48a6349168a3741e48b2731eeb2fc0adb94013a40ab7ab4c401d6f39'
AND (
token = 'Ie40adaInqpaIZckG3MtSa9UxFRo1rAZe/Wv6+r7+N8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)