UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hqhCTdAyF48IxJlbW7YcZHw3qCFvuo+x/WH4dr4sFQc='
WHERE
key_id = 'a339fbc75ff6a6ac342c71061ae3382ff0f00e7573bfd671cfa6e14d940d352d'
AND (
token = 'hqhCTdAyF48IxJlbW7YcZHw3qCFvuo+x/WH4dr4sFQc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)