UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dwe9OfDRwzHECewdk31ToRpKs7k5siaAxtCFsa15984='
WHERE
key_id = 'ad1436e892684f1db40b34ab0193a6539b76ced52b3bd45520a16d628ad43e3d'
AND (
token = 'dwe9OfDRwzHECewdk31ToRpKs7k5siaAxtCFsa15984='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)