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