UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rrD7J1uIgYTC+9IWWE/n1CqxbUZEcG2giy9cN2G/12o='
WHERE
key_id = 'c88cd36f689416e7f67adccaa0812fb43394e6636c557ada0186be678582477e'
AND (
token = 'rrD7J1uIgYTC+9IWWE/n1CqxbUZEcG2giy9cN2G/12o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)