UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K0xbZvG3YczoqvO3XVFoAxTj4h6N8UnPuToSPfyFE5s='
WHERE
key_id = '6c343a701960b406e0cd59fe0116733ae497a53d22dbe8e0011d025911d96f25'
AND (
token = 'K0xbZvG3YczoqvO3XVFoAxTj4h6N8UnPuToSPfyFE5s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)