UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'njap0Ui8MtK4OK1BitYFrKWQmWZszr5ZP5qERE9VUM8='
WHERE
key_id = '31c462e2cdffbbf8df3dd5ba693d5ad203a06dc363454872f836a357be3998ac'
AND (
token = 'njap0Ui8MtK4OK1BitYFrKWQmWZszr5ZP5qERE9VUM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)