UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7wQ3EyBTnpIOHVH2nUOTJwvgXBo3gW5loXwycISFUuw='
WHERE
key_id = 'f99c07db7c2f195bdfcc8d49c115d2c39fa0b678105201b52d866cbfc352879d'
AND (
token = '7wQ3EyBTnpIOHVH2nUOTJwvgXBo3gW5loXwycISFUuw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)