UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ItYgfXcOy9lpMAgvIhfItRWFNbhPXYiNxlfb4w3VpBs='
WHERE
key_id = '471048bcd878307b9b1cd7aec8b124cadea6248aead047f0a944310174895333'
AND (
token = 'ItYgfXcOy9lpMAgvIhfItRWFNbhPXYiNxlfb4w3VpBs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)