UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VYuykF/6/qTd0SRaIZfX7H2ZGUKkyUhH+e/Wc+fstUk='
WHERE
key_id = 'd30021f975414e531cf489f9df9be6f26477b9819438ce148ece1564a19aaf8c'
AND (
token = 'VYuykF/6/qTd0SRaIZfX7H2ZGUKkyUhH+e/Wc+fstUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)