UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd4ROsA8OsYVqEfEhLyWPUoiy1jpLVrlwRlnIN94eFeg='
WHERE
key_id = '5e574e720d469fa5547ca9f8d2cdaeef89cc0316d90c1f9d46c90fc320c61380'
AND (
token = 'd4ROsA8OsYVqEfEhLyWPUoiy1jpLVrlwRlnIN94eFeg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)